<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
        <head><title>trait Informer in org.scalatest</title>
        <meta http-equiv="content-type" content="text/html; charset=UTF8"></meta><meta content="scaladoc (version 2.7.2.final)" name="generator"></meta><link href="../../style.css" type="text/css" rel="stylesheet"></link><script type="text/javascript" src="../../script.js"></script>
        </head>
        <body onload="init()">
        <table summary="" class="navigation">
        <tr>
          <td class="navigation-links" valign="top">
            <!-- <table><tr></tr></table> -->
          </td>
          <td align="right" valign="top" style="white-space:nowrap;" rowspan="2">
            <div class="doctitle-larger">ScalaTest 0.9.4</div>
          </td>
        </tr>
        <tr><td></td></tr>
      </table>
        
      <div class="entity">
        <a href="../../org/scalatest$package.html" target="_self">org.scalatest</a>
        <br></br>
        <span class="entity">trait  Informer</span>
      </div><hr></hr>
      <div class="source">
        [source: <a href="" class="org/scalatest/Informer"><code>org/scalatest/Informer.scala</code></a>]
      </div><hr></hr>
      <a name="Informer"></a><dl>
      <dt>
        
        <code></code>
        <code>trait</code>
        <em>Informer</em>
      </dt>
      <dd><code> extends </code><a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html" target="_self">AnyRef</a></dd>
    </dl>
      <dl><dd>Trait to which custom information about a running suite of tests can be reported.
 <code>Informer</code> contains two <code>apply</code> methods, one which takes
 a string and the other a <code>Report</code>. An <code>Informer</code> is essentially
 used to wrap a <code>Reporter</code> and provide easy ways to send custom information
 to that <code>Reporter</code> via its <code>infoProvided</code> method.

 <p>
 The simplest way to use an <code>Informer</code> is to pass a string to its
 <code>apply</code> method. Given this string, the <code>Informer</code> will
 construct a <code>Report</code> using the string returned by invoking
 <code>nameForReport</code>, a method defined on <code>Informer</code>, as the name and
 the string passed to <code>apply</code> as the <code>message</code>.
 The <code>Informer</code> will then pass the newly created <code>Report</code>
 to its wrapped <code>Reporter</code> via the <code>infoProvided</code> method.
 Here's an example of using an <code>Informer</code> in a <code>Suite</code>
 subclass:
 </p>
 
 <pre>
 import org.scalatest._
 
 class MySuite extends Suite {
   def testAddition(info: Informer) {
     assert(1 + 1 === 2)
     info("Addition seems to work")
   }
 }
 </pre>

 If you run this <code>Suite</code> from the interpreter, you will see the message
 included in the printed report:

 <pre>
 scala> (new MySuite).execute()
 Test Starting - MySuite.testAddition(Reporter)
 Info Provided - MySuite.testAddition(Reporter): Addition seems to work
 Test Succeeded - MySuite.testAddition(Reporter)
 </pre>
 
 Alternatively, you could create a <code>Report</code> yourself and pass it to
 <code>apply</code>. You can invoke <code>nameForReport</code> on the
 <code>Informer</code> to get a user-friendly name to pass to the constructor of
 the <code>Report</code> you create.
 The <code>Informer</code> will then forward the passed <code>Report</code>
 to its wrapped <code>Reporter</code> via the <code>infoProvided</code> method.
 Here's an example of passing your own <code>Report</code> to an <code>Informer</code>
 in a <code>Suite</code> subclass:
 </p>
 
 <pre>
 import org.scalatest._

 class MySuite extends Suite {
   def testAddition(info: Informer) {
     assert(1 + 1 === 2)
     val myReport =
       new Report(info.nameForReport, "Here's a stack trace", Some(new Exception), None)
     info(myReport)
   }
 }
 </pre>

 If you run this <code>Suite</code> from the interpreter, you will see the message
 included in the printed report:

 <pre>
 scala> (new MySuite).execute()
 Test Starting - MySuite.testAddition(Informer)
 Info Provided - MySuite.testAddition(Informer): Here's a stack trace
 java.lang.Exception
   at line3$object$$iw$$iw$$iw$MySuite.testAddition(<console>:10)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.scalatest.Suite$class.runTest(Suite.scala:1085)
   at line3$object$$iw$$iw$$iw$MySuite.runTest(<console>:6)
   ...
   at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
 Test Succeeded - MySuite.testAddition(Informer)
 </pre>

 <p>
 Besides sending a stack trace, you might want to create and pass your own
 <code>Report</code> if you've defined one or more <code>Report</code> subclasses that
 are recognized and handled specially by a <code>Reporter</code> subclass you've defined.
 See the "Extensibility" section in the documentation for <code>Report</code> for more 
 information.
 </p></dd></dl>
      <dl><dt style="margin:10px 0 0 20px;">
        <b>Author</b></dt><dd>Bill Venners</dd></dl>
    
      


<table summary="" cellpadding="3" class="member">
      <tr><td class="title" colspan="2">Method Summary</td></tr>
      <tr>
      <td class="modifiers" valign="top"> 
        <code>abstract def</code>
      </td>
      <td class="signature">
        <em><a href="../../org/scalatest/Informer.html#apply%28String%29" target="_self">apply</a></em>
        (<em>message</em> : <a href="" target="contentFrame" class="java/lang/String">java.lang.String</a>) : <a href="http://www.scala-lang.org/docu/files/api/scala/Unit.html" target="_self">Unit</a>
        
        <div>Provide information in the form of a string message to be reported to the
   wrapped <code>Reporter</code>'s <code>infoProvided</code> method. This method
   will create a <code>Report</code> via <code>Report</code>'s auxiliary constructor that takes a
   string name and message, using the string returned by invoking
   <code>nameForReport</code> as the name and the passed string as the message, and pass
   the newly created <code>Report</code> to the wrapped <code>Reporter</code>'s
   <code>infoProvided</code> method.</div>
      </td>
    </tr>
<tr>
      <td class="modifiers" valign="top"> 
        <code>abstract def</code>
      </td>
      <td class="signature">
        <em><a href="../../org/scalatest/Informer.html#apply%28org.scalatest.Report%29" target="_self">apply</a></em>
        (<em>report</em> : <a href="../../org/scalatest/Report.html" target="_self">Report</a>) : <a href="http://www.scala-lang.org/docu/files/api/scala/Unit.html" target="_self">Unit</a>
        
        <div>Provide information in the form of a <code>Report</code> to be reported to the
   wrapped <code>Reporter</code>'s <code>infoProvided</code> method.</div>
      </td>
    </tr>
<tr>
      <td class="modifiers" valign="top"> 
        <code>abstract def</code>
      </td>
      <td class="signature">
        <em><a href="../../org/scalatest/Informer.html#nameForReport" target="_self">nameForReport</a></em>
         : <a href="" target="contentFrame" class="java/lang/String">java.lang.String</a>
        
        <div>A name suitable for passing to the constructor of a <code>Report</code>
   when using the <code>apply</code> method that takes a <code>Report</code>.
   For example, in an <code>Informer</code> passed to a test method in
   trait <code>Suite</code>, this method will return from this method a
   user-friendly name for the test (the same name used for the test by <code>Suite</code>
   when making <code>testStarting</code>, <code>testSucceeded</code>, etc., reports).</div>
      </td>
    </tr>
      </table><table summary="" cellpadding="3" class="inherited">
        <tr><td class="title" colspan="2">
          Methods inherited from <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html" target="_self">AnyRef</a>
        </td></tr>
        <tr><td class="signature" colspan="2">
          <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#getClass%28%29" target="_self">getClass</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#hashCode%28%29" target="_self">hashCode</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#equals%28Any%29" target="_self">equals</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#clone%28%29" target="_self">clone</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#toString%28%29" target="_self">toString</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#notify%28%29" target="_self">notify</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#notifyAll%28%29" target="_self">notifyAll</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#wait%28Long%29" target="_self">wait</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#wait%28Long%2CInt%29" target="_self">wait</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#wait%28%29" target="_self">wait</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#finalize%28%29" target="_self">finalize</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#%3D%3D%28AnyRef%29" target="_self">==</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#%21%3D%28AnyRef%29" target="_self">!=</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#eq%28AnyRef%29" target="_self">eq</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#ne%28AnyRef%29" target="_self">ne</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/AnyRef.html#synchronized%28T0%29" target="_self">synchronized</a>
        </td></tr>
      </table><table summary="" cellpadding="3" class="inherited">
        <tr><td class="title" colspan="2">
          Methods inherited from <a href="http://www.scala-lang.org/docu/files/api/scala/Any.html" target="_self">Any</a>
        </td></tr>
        <tr><td class="signature" colspan="2">
          <a href="http://www.scala-lang.org/docu/files/api/scala/Any.html#%3D%3D%28Any%29" target="_self">==</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/Any.html#%21%3D%28Any%29" target="_self">!=</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/Any.html#isInstanceOf" target="_self">isInstanceOf</a>, <a href="http://www.scala-lang.org/docu/files/api/scala/Any.html#asInstanceOf" target="_self">asInstanceOf</a>
        </td></tr>
      </table>


      


<table summary="" cellpadding="3" class="member-detail">
          <tr><td class="title">Method Details</td></tr>
        </table><div><a name="apply%28org.scalatest.Report%29"></a><dl>
      <dt>
        
        <code>abstract</code>
        <code>def</code>
        <em>apply</em>(<em>report</em> : <a href="../../org/scalatest/Report.html" target="_self">Report</a>) : <a href="http://www.scala-lang.org/docu/files/api/scala/Unit.html" target="_self">Unit</a>
      </dt>
      <dd></dd>
    </dl>
      <dl><dd>Provide information in the form of a <code>Report</code> to be reported to the
   wrapped <code>Reporter</code>'s <code>infoProvided</code> method.</dd></dl>
      <dl><dt style="margin:10px 0 0 20px;">
        <b>Parameters</b></dt><dd><code>report - </code>a <code>Report</code> that encapsulates the event to report.</dd><dt style="margin:10px 0 0 20px;">
        <b>Throws</b></dt><dd><code>NullPointerException - </code>if <code>report</code> reference is <code>null</code></dd></dl>
    <hr></hr>
<a name="apply%28String%29"></a><dl>
      <dt>
        
        <code>abstract</code>
        <code>def</code>
        <em>apply</em>(<em>message</em> : <a href="" target="contentFrame" class="java/lang/String">java.lang.String</a>) : <a href="http://www.scala-lang.org/docu/files/api/scala/Unit.html" target="_self">Unit</a>
      </dt>
      <dd></dd>
    </dl>
      <dl><dd>Provide information in the form of a string message to be reported to the
   wrapped <code>Reporter</code>'s <code>infoProvided</code> method. This method
   will create a <code>Report</code> via <code>Report</code>'s auxiliary constructor that takes a
   string name and message, using the string returned by invoking
   <code>nameForReport</code> as the name and the passed string as the message, and pass
   the newly created <code>Report</code> to the wrapped <code>Reporter</code>'s
   <code>infoProvided</code> method.</dd></dl>
      <dl><dt style="margin:10px 0 0 20px;">
        <b>Parameters</b></dt><dd><code>report - </code>a <code>Report</code> that encapsulates the event to report.</dd><dt style="margin:10px 0 0 20px;">
        <b>Throws</b></dt><dd><code>NullPointerException - </code>if <code>message</code> reference is <code>null</code></dd></dl>
    <hr></hr>
<a name="nameForReport"></a><dl>
      <dt>
        
        <code>abstract</code>
        <code>def</code>
        <em>nameForReport</em> : <a href="" target="contentFrame" class="java/lang/String">java.lang.String</a>
      </dt>
      <dd></dd>
    </dl>
      <dl><dd>A name suitable for passing to the constructor of a <code>Report</code>
   when using the <code>apply</code> method that takes a <code>Report</code>.
   For example, in an <code>Informer</code> passed to a test method in
   trait <code>Suite</code>, this method will return from this method a
   user-friendly name for the test (the same name used for the test by <code>Suite</code>
   when making <code>testStarting</code>, <code>testSucceeded</code>, etc., reports).</dd></dl>
      <dl><dt style="margin:10px 0 0 20px;">
        <b>Returns</b></dt><dd>a name suitable for passing to a <code>Report</code> constructor.</dd></dl>
    <hr></hr></div>


    <hr></hr>
        <div>Copyright (C) 2001-2008 Artima, Inc. All rights reserved.</div><table summary="" class="navigation">
        <tr>
          <td class="navigation-links" valign="top">
            <!-- <table><tr></tr></table> -->
          </td>
          <td align="right" valign="top" style="white-space:nowrap;" rowspan="2">
            <div class="doctitle-larger">ScalaTest 0.9.4</div>
          </td>
        </tr>
        <tr><td></td></tr>
      </table>
      </body>
      </html>